<!-- 管理员审核商品页面 -->
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
    <title>管理员审核商品页面</title>
</head>
<script language="javascript">
function printpage()
  {
  window.print()
  }
</script>
<?php 
include_once("inc.php");
include_once("base.php");
$tb_name = "goods";
$where_sql = "pid=1";
include_once ROOT_PATH."/common/where.php";
$list = db_get_page("select * from $tb_name where $where_sql order by id desc", $page,20);
include_once ROOT_PATH."/common/page.php";
?>
<body>
	<table width="100%" border="0" cellpadding="0" cellspacing="0">
		<tr>
			<td width="17" rowspan="2" valign="top" bgcolor="#FFFFFF"></td>
			<td valign="top">
				<table width="100%" height="31" border="0" cellpadding="0" cellspacing="0">
					<tr bgcolor="#FFFFFF">
						<td height="31">
							<div class="title">商品审核</div>
						</td>
					</tr>
				</table>
			</td>
			<td width="16" rowspan="2" bgcolor="#FFFFFF"></td>
		</tr>
		<tr>
			<td valign="top" bgcolor="#F7F8F9">
				<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
					<tr>
						<td colspan="4" height="10"></td>
					</tr>
					<tr>
						<td width="1%">&nbsp;</td>
						<td width="96%">
							<table width="100%" class="cont">
								<tr>
									<td width="1%"></td>
									<td>
										<form id="form1" name="form1" action="?" method="get">
											<input type="hidden" name="pid" value="<?php echo $_REQUEST["pid"]; ?>"/>
											<select name="status">
												<option value="">请选择状态</option>
												<option value="未审核" <?php if($_REQUEST["status"]=="未审核"){echo "selected";}?>>未审核</option>
												<option value="已审核" <?php if($_REQUEST["status"]=="已审核"){echo "selected";}?>>已审核</option>
											</select>
											<select name="categoryid">
												<option value="">-- 请选择 --</option>
												<?php
												$categoryA = db_get_all("select * from category where pid=1 order by id asc");
												foreach($categoryA as $row) {
													?>
													<option value="<?php echo $row["id"];?>" <?php if($_REQUEST["categoryid"]==$row["id"]){echo 'selected="selected"';}?>><?php echo $row["title"];?></option>
												<?php } ?>
											</select>
											<input type="text" name="title" class="text" value="<?php echo $_REQUEST["title"]; ?>" placeholder="输入商品名称"/>
											<button type="submit"  id="chaxun" class="btn">查询</button>
										</form>
									</td>
								</tr>
							</table>
						</td>
						<td width="1%">&nbsp;</td>
					</tr>
					<tr>
						<td width="1%">&nbsp;</td>
						<td width="96%">
							<form action="?" method="get" name="lsm" id="lsm">
								<input type="hidden" name="chk" value="ok" />
								<input type="hidden" name="title" value="<?php echo $_REQUEST["title"]; ?>"/>
								<input type="hidden" name="pnumber" value="<?php echo $_REQUEST["pnumber"]; ?>"/>
								<input type="hidden" name="categoryid" value="<?php echo $_REQUEST["categoryid"]; ?>"/>
								<input type="hidden" name="pid" value="<?php echo $_REQUEST["pid"]; ?>"/>
								<table width="100%">
									<td colspan="2">
										<table width="100%"  class="cont tr_color">
											<tr>
												<th width="30"></th>
												<th>商品名称</th>
												<th>商品图片</th>
												<th>现价</th>
												<th>数量</th>
												<th>上下架</th>
												<th>发布者</th>
												<th>审核状态</th>
												<th>推荐</th>
												<th width="120">操作</th>
											</tr>
											<?php
											foreach($list["data"] as $row) {?>
											<tr align="center" class="d">
												<td>
													<input type="checkbox" name="sel_id[]" id="sel_id" value="<?php echo $row['id'];?>">
												</td>
												<td>
													<?php echo $row['title'];?>
												</td>
												<td align="center">
													<?php if(!empty($row['img'])){?><img src="../Public/Upload/<?php echo $row["img"];?>" height="100" width="100"/><?php }?>
												</td>
												<td align="center">
													<?php echo $row['sprice'];?>
												</td>
												<td align="center">
													<?php echo $row['amount'];?>
												</td>
												<td align="center">
													<?php if($row["isno"]==0){?>
														<a href="?act=yes&pid=<?php echo $_REQUEST["pid"]; ?>&id=<?php echo $row["id"];?>" onclick='return confirm("确认下架吗？");'>点击下架</a>
													<?php
													} else{?>
														<a href="?act=no&pid=<?php echo $_REQUEST["pid"]; ?>&id=<?php echo $row["id"];?>" onclick='return confirm("确认上架吗？");'><font color="#FF0000">点击上架</font></a>
													<?php }?>
												</td>
												<td align="center">
													<?php echo db_get_val("user",$row["userid"],"nickname")?>
												</td>
												<td align="center">
													<?php echo $row['status'];?>
												</td>
												<td align="center">
													<?php if($row["isnice"]==0){?>
													<a href="?act=recommend&pid=<?php echo $_REQUEST["pid"]; ?>&id=<?php echo $row["id"];?>" onclick='return confirm("确认推荐吗？");'>推荐</a>
													<?php
													} else{?><a href="?act=oppose&pid=<?php echo $_REQUEST["pid"]; ?>&id=<?php echo $row["id"];?>" onclick='return confirm("取消推荐吗？");'><font color="#FF0000">取消推荐</font></a><?php }?>
												</td>
												<td align="center">
													<a href="<?php echo $tb_name;?>_edit.php?id=<?php echo $row['id'];?><?php echo $condition;?>">查看</a>
												</td>
											</tr>
											<?php } ?>
											<tr align="center" class="d">
												<td></td>
												<td colspan="9" align="left">
													&nbsp;&nbsp;<input type="checkbox" id="sel_all" value="yes"  onClick="select_all(this.form)">
													<strong>全选</strong>  
													<select name="sel_do" size="1" id="sel_do">
														<option value="">--选择状态--</option>
														<option value="已审核">审核</option>
														<option value="未审核">设为未审核</option>
														<option value="delgoods">删除</option>
													</select>
													<input type="submit" value="操作" onClick="return sel_click(this.form)">
												</td>
											</tr>
										</table>
									</td>
								</tr>
							</table>
							</form>
							<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1">
								<tr>
									<td align="center"><?php echo $page_show;?></td>
								</tr>
							</table>    
						</td>
						<td width="1%">&nbsp;</td>
					</tr>
					<tr><td height="20"></td></tr>
				</table>
			</td>
		</tr>
	</table>
<?php
	$act = !empty($_GET['act']) ? trim($_GET['act']) : '';
	if($act == 'yes')
	{
		$data = array();
		$data["isno"] = 1;
		db_mdf($tb_name,$data,$_REQUEST["id"]);
		urlMsg("19操作成功", $tb_name."_list.php?".$condition);
	}
	if($act == 'no')
	{
		$data = array();
		$data["isno"] = 0;
		db_mdf($tb_name,$data,$_REQUEST["id"]);
		urlMsg("20操作成功", $tb_name."_list.php?".$condition);
	}
	if($act == 'recommend')
	{
		$data = array();
		$data["isnice"] = 1;
		db_mdf($tb_name,$data,$_REQUEST["id"]);
		urlMsg("推荐成功", $tb_name."_list.php?".$condition);
	}
	if($act == 'oppose')
	{
		$data = array();
		$data["isnice"] = 0;
		db_mdf($tb_name,$data,$_REQUEST["id"]);
		urlMsg("取消推荐成功", $tb_name."_list.php?".$condition);
	}
	
?>
</body>
</html>